package com.timesheet.serverice;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
 
public class ReferenceTest {
	public static void main(String[] args) throws InterruptedException {
 
			List list = new ArrayList();
            WeakReference r = new WeakReference(list);
            WeakReference sr = new WeakReference(new String("I'm here"));
            System.out.println("before gc: r=" + r.get() + ", static=" + sr.get());
            System.gc();
            Thread.sleep(100);
 
            // only r.get() becomes null
            System.out.println("after gc: r=" + r.get() + ", static=" + sr.get());
 
	}
}